<template>
  <div class="header">
    <div class="fiextop">
      <div class="top f fb">
        <div class="topLeft f fl">
          <img src="../../static/images/bbi/logo.jpg" />
          <ul class="bottom_ul f fl">
            <li
              class="bottom_li"
              v-for="(item, index) in list"
              :key="index"
              :class="{ navhover: otherNav == index }"
              @click="changeIndex(index)"
              @mouseover="mouseOver(item, index)"
            >
              <router-link
                class="router"
                :class="[item.cls, 'nav-' + (index + 1)]"
                :to="{
                  path: item.url,
                }"
              >
                {{ item.name }}
                <i class="el-icon-arrow-down" v-show="item.child"></i>
              </router-link>

              <ul class="small_ul slideInDown" v-if="item.child">
                <li
                  class="small_li"
                  v-for="(item, index) in childList"
                  :key="index"
                  @click="childIndex(index)"
                  :class="{ childActive: childActive == index }"
                >
                  <router-link
                    :to="{
                      path: item.url,
                      query: { id: item.id, parentType: item.parentType },
                    }"
                  >
                    {{ item.name }}
                  </router-link>
                </li>
              </ul>
            </li>
          </ul>
        </div>
        <div class="topRight1 f fc">
          <p class="register">注册</p>
          <p class="login f fc">登录</p>
          <p class="email">
            邮箱登录 <img src="../../static/images/bbi/head1.jpg" alt="" />
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      childList: [],
      otherNav: 0,
      navshow: false,
      list: [
        {
          url: '/',
          name: '首页'
        },
        {
          url: '/digitaIncubation',
          name: '数字孵化'
        },
        {
          url: '/service',
          name: '汇创业',
          child: [
            { url: '/space', name: '空间' },
            { url: '/service', name: '服务' }
          ]
        },
        {
          url: '/huichuangcamp',
          name: '汇创营'
        },
        {
          url: '/huichuangtou',
          name: '汇创投'
        },
        {
          url: '/park',
          name: '园区'
        },
        {
          url: '/news',
          name: '资讯',
          child: [
            { url: '/news', name: '新闻' },
            { url: '/news', name: '政策' }
          ]
        },
        {
          url: '/aboutUs',
          name: '关于我们'
        }
      ],
      childActive: 0,
      bannerList: [
        {
          id: 0,
          img: '../../static/images/bbi/banner1.jpg',
          title: '众创空间+孵化器+加速器',
          desc:
            '人工智能全链条孵化体系和硬科技孵化服务平台，建立服务流程与标准，创建战略新兴产业源头企业 专业化服务模式'
        },
        {
          id: 1,
          img: '../../static/images/bbi/banner2.jpg',
          title: '众创空间+孵化器+加速器',
          desc:
            '人工智能全链条孵化体系和硬科技孵化服务平台，建立服务流程与标准，创建战略新兴产业源头企业 专业化服务模式'
        }
      ]
    }
  },

  methods: {
    // 设置导航选中
    changeIndex (index) {
      this.otherNav = index
    },
    // 切换小标题
    childIndex (index) {
      this.childActive = index
    },
    setNav () {
      let url = this.$route.path
      if (url == '/') {
        this.changeIndex(0)
      } else if (url == '/digitaIncubation') {
        this.changeIndex(1)
      } else if (url == '/service' || url == '/space') {
        this.changeIndex(2)
      } else if (url == '/huichuangcamp') {
        this.changeIndex(3)
      } else if (url == '/huichuangtou') {
        this.changeIndex(4)
      } else if (url == '/park' || url == '/parkDetail') {
        this.changeIndex(5)
      } else if (url == '/news' || url == '/newsDetail') {
        this.changeIndex(6)
      } else if (url == '/aboutUs') {
        this.changeIndex(7)
      }
    },
    // nav导航鼠标移入
    mouseOver (item, index) {
      if (item.child) {
        this.childList = item.child
      }
    }
  },
  created () {},
  mounted () {}
}
</script>
<style lang="scss" scoped>
@import "../assets/css/animation.css";
.flexdiv {
  display: flex;
  align-items: center;
}
.header {
  width: 100%;
  position: fixed;
  top: 0;
  z-index: 99999;
  background: #fff;
  left: 0;
  right: 0;
  margin: 0 auto;
  .fiextop {
    width: 1300px;
    height: 90px;
    margin: 0 auto;
    box-sizing: border-box;
  }
  .top {
    width: 100%;
    height: 100%;
    .topLeft {
      height: 100%;
      img {
        width: 136px;
        height: 46px;
        margin-right: 90px;
      }
      .bottom_ul {
        width: 100%;
        height: 100%;

        .router {
          width: 88px;
          height: 100%;
          display: inline-block;
          line-height: 90px;
          text-align: center;
        }

        a:hover > .textspan {
          border-right: none;
        }
        a {
          font-size: 16px;
          color: #333;
        }
        .mouseHoverActive {
          margin-left: -1px;
          width: 100%;
          height: 100%;
          background: #0099df;
          color: #fff !important;
          border-left: 1px solid #0099df;
        }
        .navhover {
          background: #f5f5f5;
        }
        .navhover a {
          color: #1db9e0;
        }
        .bottom_li:last-child p {
          border: none;
        }
        .bottom_li:hover .small_ul {
          display: block;
          background: #f5f5f5;
        }
        .bottom_li:hover {
          background: #f5f5f5;
        }
        .bottom_li {
          width: 88px;
          height: 100%;
          font-size: 14px;
          font-family: Microsoft YaHei, Microsoft YaHei-Regular;
          font-weight: 400;
          text-align: left;
          color: #333333;
          text-align: center;
          cursor: pointer;
          position: relative;
          .small_ul {
            display: none;
            position: absolute;
            width: 88px;
            height: 80px;
            background: #f5f5f5;
            color: #333;
            .small_li {
              width: 100%;
              height: 50%;
              display: flex;
              align-items: center;
              justify-content: center;
              color: #333;
              a {
                color: #333;
              }
            }
            .childActive {
              background: #fff;
              a {
                color: #1db9e0 !important;
              }
            }
          }
        }
      }
    }
    .topRight1 {
      .register {
        font-size: 14px;
        font-family: Microsoft YaHei, Microsoft YaHei-Regular;
        font-weight: 400;
        color: #333333;
        margin-right: 30px;
        cursor: pointer;
      }
      .login {
        margin-right: 30px;
        width: 110px;
        height: 45px;
        opacity: 1;
        background: #1db9e0;
        border-radius: 23px;
        font-size: 13px;
        font-family: Segoe UI, Segoe UI-Semibold;
        font-weight: 600;
        color: #ffffff;
                cursor: pointer;
      }
    }
  }
}
</style>
